package pl.vanta.utils.commons.validators.impl;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import pl.vanta.utils.commons.CollectionUtils;

public class CracowClimbingScaleValidator extends RegexpValidator
{
	public static final String[]	CORRECT_VALUES	= new String[] { "I", "II", "II+", "III", "III+", "IV", "IV+", "V-", "V", "V+", "VI-", "VI",
			"VI+", "VI.1", "VI.1+", "VI.2", "VI.2+", "VI.3", "VI.3+", "VI.4", "VI.4+", "VI.5", "VI.5+", "VI.6", "VI.6+", "VI.7", "VI.7+", "VI.8" };

	private static final String		REGEXP			= "(I|II|II\\+|III|III\\+|IV|IV\\+|V|V-|V\\+|VI-|VI\\+|VI(\\.[1-8]\\+?)?)";

	public CracowClimbingScaleValidator()
	{
		super(REGEXP);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<String> validateWithErrors(String string)
	{
		if (super.validateWithErrors(string).isEmpty())
		{
			return Collections.EMPTY_LIST;
		}
		else
		{
			return CollectionUtils.list(String.format("Incorrect value: %s. Value should be one of: %s", string, Arrays.asList(CORRECT_VALUES)
					.toString()));
		}
	}
}